package org.dong.Dao;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class DaoFactory {
//    private  static Map<Class,Object> daoMap = new HashMap<>();
//    static {
//        daoMap.put(UserDao.class,new UserDaoImpl());
//
//    }
//
//    public static Object getDao(Class inter){
//        return  daoMap.get(inter);
//    }

    public  void DaoReflex(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
        // 读取配置文件
        Properties props = new Properties();
        props.load(new FileInputStream("JdbcMysql.properties"));
        // 使用反射机制动态加载DAO实现类
        String className = props.getProperty("className");
        Class<?> cls = Class.forName(className);
        Object obj = cls.newInstance();
//        Method method = cls.getMethod();
    }

}
